package 蓝桥真题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class 完全二叉树的权值 {
       static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       final static int N=1000100;
       static int a[]=new int[N],n;
       
       public static void main(String[] args) throws IOException {
		      n=Integer.parseInt(br.readLine());
		      String[]ss=br.readLine().split(" ");
		      for(int i=1;i<=n;i++)
		    	  a[i]=Integer.parseInt(ss[i-1]);
		      long res=0,d=0;
		      for(int i=0;1<<i<n;i++){
		    	  int t=1<<i;
		    	  long s=0;
		    	  while(t<1<<(i+1)){
		    		  s+=a[t];
		    		  t++;
		    	  }
		    	  if(s>res){
		    		  res=s;
		    		  d=i+1;
		    	  }
		      }
		      System.out.print(d);
	}
}
